package com.riverstar.wwndemo.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.HorizontalSplitPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ImageBundle;

public class CenterPanel extends Composite implements ClickHandler {
	
	public interface Images extends ImageBundle {
		@Resource("riverglo-sidebar.gif")
		AbstractImagePrototype sidebar();
	}
	
	private HorizontalPanel outer = new HorizontalPanel();
	
	public CenterPanel(Images images) {
		outer.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
		HorizontalSplitPanel hSplit = new HorizontalSplitPanel();

		Image header_logo = images.sidebar().createImage();
		hSplit.setLeftWidget(header_logo);
		//outer.add( header_logo);
		hSplit.setRightWidget(new HTML("HELLO WORLD!"));

		System.out.println(hSplit);
		//outer.add( new HTML("HELLO WORLD!"));
		outer.add(hSplit);
		outer.setStyleName("centerPanel");
		
		initWidget(outer);
	}

	@Override
	public void onClick(ClickEvent event) {
		Object sender = event.getSource();
		
	}

	public void adjustSize(int width, int height) {
		this.outer.setPixelSize(width, height-10);
	}

}
